package com.shujia.three;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class CollectionDemo {

    public static void main(String[] args) {
        Person p1 = new Person();
        List list = new ArrayList();
        list.add(1);
        list.add("nihao");
        list.add(3.14);
        list.add(p1);

        Iterator iterator = list.iterator();

        while (iterator.hasNext()) {
            // 只能使用Object类型来接收
            Object obj = iterator.next();
            System.out.println(obj);
        }
    }
}

class Person {

}
